home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / TextHarvest / TextHarvest-Install.exe / {app} / ScriptSample04.txt < prev    next >
Text File  |  2005-02-22  |  3KB  |  69 lines

  1. ;===============================================================================
  2. ; Sample Script for Pinnacle Software's TextHarvest Product
  3. ;===============================================================================
  4. ;
  5. ;   This script was designed for the ToDoListFixed.dat sample input file,
  6. ;   which is included with Pinnacle Software's script-enabled product
  7. ;   TextHarvest (free download at www.parse-o-matic.com). The file is a
  8. ;   fixed-record-length file with a record length of 80.
  9. ;
  10. ;   This script converts the file (which apart from its data format is
  11. ;   identical to the sample file ThingsToDo.txt) to CSV (Comma Separated
  12. ;   Value) format. The CSV file will contain the two fields from the input
  13. ;   file, along with a record counter.
  14. ;
  15. ;===============================================================================
  16. ; Config section
  17. ;==============================================================================
  18. Config
  19.   ;-----------------------------------------------------------------------------
  20.   ; Files
  21.   ;-----------------------------------------------------------------------------
  22.   $CfgDefaultIFN    = 'ToDoListFixed.dat'
  23.   $CfgDefaultOFN    = 'Temp.csv'
  24.   $CfgInpFileType   = 'Binary'
  25.   $CfgRecLen        = 80
  26.   $CfgOutFileType   = 'Text'
  27.   ;-----------------------------------------------------------------------------
  28.   ; Documentation
  29.   ;-----------------------------------------------------------------------------
  30.   $CfgCopyright     = 'Copyright ⌐ 2005 by Pinnacle Software'
  31.   $CfgVersion       = '1.00.00'
  32.   $CfgProgrammer    = 'Timothy Campbell'
  33.   $CfgEmail         = 'info@parse-o-matic.com'
  34.   $CfgLicense       = 'This script may be used, at no charge, with any ' >>
  35.     'script-enabled Parse-O-Matic application, subject to any additional ' >>
  36.     'licensing requirements of such application.'
  37. End
  38. ;===============================================================================
  39. ; Check settings
  40. ;===============================================================================
  41. TaskInit
  42.   Begin $ActualIFN ~ $CfgDefaultIFN
  43.     Stop 'Please try this script with the' $0A$0D >>
  44.       'input file' $CfgDefaultIFN
  45.   End
  46.   RecNum = 0
  47. End
  48. ;===============================================================================
  49. ; Get the category, remove extra spaces, and change case
  50. ;===============================================================================
  51. Category = $OutData[1 9]                    ; Get columns 1 to 9
  52. TrimChar Category                           ; Remove spaces on either side
  53. Category = ChangeCase Category 'Hardcaps'   ; Capitalize The Text
  54. ;===============================================================================
  55. ; Get the description and remove the trailing spaces.
  56. ;===============================================================================
  57. Description = $OutData[10 80]
  58. TrimChar Description 'R '
  59. ;===============================================================================
  60. ; Send CSV data to the output file
  61. ;===============================================================================
  62. Inc RecNum
  63. PadRecNum = Padded RecNum 3 'Left' '0'
  64. OutCSV '' 'Init'
  65. OutCSV PadRecNum 'Unquoted'
  66. OutCSV Category
  67. OutCSV Description
  68. OutCSV '' 'Done'
  69.